<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h2>0</h2>
    <button onclick="minus()">-1</button>
    <button onclick="plus()">+1</button>

    <script>
        function minus() {
            var h2 = document.querySelector('h2');
            var num = parseInt(h2.innerText);
            h2.innerText = num - 1;
        }

        function plus() {
            var h2 = document.querySelector('h2');
            var num = parseInt(h2.innerText);
            h2.innerText = num + 1;
        }
    </script>
</body>
</html>